package com.llseven.ai.spring.llseven.util;

/**
 * @author ywb
 * @date 2025-04-21 20:25
 */
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseUtils {
    private static final String URL = "jdbc:mysql://appuser-ywb-database.mysql.rds.aliyuncs.com:33060/llseven?useUnicode=true&characterEncoding=utf8";
    private static final String USERNAME = "root";
    private static final String PASSWORD = "JS6T4TjnJVjpY13UgXnyq5";
    private static final String DRIVER_CLASS = "com.mysql.cj.jdbc.Driver";
    
    static {
        try {
            // 注册JDBC驱动
            Class.forName(DRIVER_CLASS);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    
    // 获取数据库连接
    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(URL, USERNAME, PASSWORD);
    }
}

